import { IParam } from '../../common';
import { IAbility } from './i-ability';
import { IStore } from './i-store';

/**
 * 控制器基类接口
 *
 * @export
 * @interface IController
 */
export interface IController<
	S extends IStore = IStore,
	A extends IAbility = IAbility
> {
	/**
	 * 获取模型数据
	 *
	 * @template T
	 * @return {*}  {T}
	 * @memberof IViewController
	 */
	getModel<T>(): T;

	/**
	 * 获取仓库数据
	 *
	 * @template T
	 * @return {*}  {T}
	 * @memberof IViewController
	 */
	getStore(): S;

	/**
	 * 获取数据
	 *
	 * @return {*}  {IParam[]}
	 * @memberof IController
	 */
	getData(): IParam[];

	/**
	 * 获取能力
	 *
	 * @template T
	 * @return {*}  {T}
	 * @memberof IController
	 */
	getAbility(): A;

	/**
	 * 获取子能力块
	 *
	 * @template T
	 * @param {string} name 子能力块名称
	 * @return {*}  {T}
	 * @memberof IController
	 */
	getSubAbility<A extends IAbility = IAbility>(name: string): A;

	/**
	 * 设置子能力块
	 *
	 * @param {string} name
	 * @param {IAbility} subAbility
	 * @memberof IController
	 */
	setSubAbility(name: string, subAbility: IAbility): void;

	/**
	 * 设置导航参数
	 *
	 * @param {IParam} context 视图上下文
	 * @param {IParam} viewParams 视图导航参数
	 * @param {IParam} viewCtx 视图操作参数
	 * @memberof IViewController
	 */
	setNavParams(context: IParam, viewParams: IParam, viewCtx?: IParam): void;
}
